import axios from 'axios';

const url = '/adminapi/dashboard/'

export interface ChartDataRecord {
  x: string;
  y: number;
  name?: string;
}

export interface ChainParams {
  quota: string;
}

export interface ChartOpinionRes {
  count: number;
  growth: number;
  chartData: ChartDataRecord[];
}

/**
 * 总数统计
 */
export function apiCount(params?: any) {
  return axios.get<any>(`${url}count`, { params });
}

/**
 * 会员统计
 */
export function apiMember(params?: any) {
  return axios.get<any>(`${url}member`, { params });
}

/**
 * 内容统计
 */
export function apiCms(params?: any) {
  return axios.get<any>(`${url}cms`, { params });
}

/**
 * 文件统计
 */
export function apiFile(params?: any) {
  return axios.get<any>(`${url}file`, { params });
}

/**
 * 数据总览
 */
export function apiOverview(params?: any) {
  return axios.get<any>(`${url}overview`, { params });
}

/**
 * 趋势
 */
export function apiChainGrowth(params?: any) {
  return axios.get<any>(`${url}chainGrowth`, { params });
}